/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import controller.Action;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import persistense.ContaDAO;
import state.ContaEstado;

/**
 *
 * @author Aurelio
 */
public class ManterContaAction implements Action{
    private static final String FORWARD = "manterConta.jsp";
    
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException{
        try{
            String numero = request.getParameter("numero_conta");
            ContaEstado conta = ContaDAO.getInstance().recuperarEstado(numero);
            request.setAttribute("mensagem", conta.montarMensagem());
            RequestDispatcher rd = request.getRequestDispatcher(FORWARD);
            rd.forward(request, response);
        
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
    
}
